<?php

/**
 * Test form base class.
 *
 * @method Test getObject() Returns the current form's model object
 *
 * @package    tests
 * @subpackage form
 * @author     Djul
 */
abstract class BaseTestForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'test_block_id'      => new sfWidgetFormPropelChoice(array('model' => 'TestBlock', 'add_empty' => false)),
      'name'               => new sfWidgetFormInputText(),
      'time'               => new sfWidgetFormInputText(),
      'amount_task_level1' => new sfWidgetFormInputText(),
      'amount_mark_level1' => new sfWidgetFormInputText(),
      'amount_task_level2' => new sfWidgetFormInputText(),
      'amount_mark_level2' => new sfWidgetFormInputText(),
      'amount_task_level3' => new sfWidgetFormInputText(),
      'amount_mark_level3' => new sfWidgetFormInputText(),
      'is_published'       => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorPropelChoice(array('model' => 'Test', 'column' => 'id', 'required' => false)),
      'test_block_id'      => new sfValidatorPropelChoice(array('model' => 'TestBlock', 'column' => 'id')),
      'name'               => new sfValidatorString(array('max_length' => 255)),
      'time'               => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'amount_task_level1' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'amount_mark_level1' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'amount_task_level2' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'amount_mark_level2' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'amount_task_level3' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'amount_mark_level3' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'is_published'       => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'Test', 'column' => array('test_block_id', 'name')))
    );

    $this->widgetSchema->setNameFormat('test[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Test';
  }


}
